package chap6;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class ArrInput {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        double []d=new double[10];
        for(int i=0;i<d.length;i++){
            System.out.print("请输入数组的第"+(i+1)+"个值：");
            d[i]=in.nextDouble();
        }
        System.out.println("输入的数字如下：");
        for(int i=0;i<d.length;i++){
            System.out.print(d[i]+"\t");
        }
        System.out.println();
        System.out.println("平均值：");
        double sum=0,avg=0;
        //求和
        for (int i = 0; i <d.length ; i++) {
            sum=sum+d[i];
        }
        avg=sum/d.length;
        System.out.println("均值是："+avg);
    }
}
